/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rmiclient;

import comunicacao.ReceiveMessageInterface;
import java.rmi.*;
import java.rmi.registry.*;
import java.net.*;

/**
 *
 * @author Leonardo Lino
 */
public class RmiClient
{
    static public void main(String args[])
    {
       ReceiveMessageInterface rmiServer;
       Registry registry;
       String serverAddress="127.0.0.1";
       String serverPort="3232";
       String text="ola ola";
       System.out.println("sending "+text+" to "+serverAddress+":"+serverPort);
       try{
          
           // get the �gregistry�h
           registry=LocateRegistry.getRegistry(
               serverAddress,
               (new Integer(serverPort)).intValue()
           );
           // look up the remote object
           rmiServer=
              (ReceiveMessageInterface)(registry.lookup("rmiServer"));
           // call the remote method
           //rmiServer.receiveMessage(text);
       }
       catch(RemoteException e){
           e.printStackTrace();
       }
       catch(NotBoundException e){
           e.printStackTrace();
       }
    }
}

